<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>let</title>
</head>
<body>
	<ul>
		<li>1</li>
		<li>2</li>
		<li>3</li>
		<li>4</li>
		<li>5</li>
	</ul>
	<script>
		var liList = document.getElementsByTagName("li");
		for(let i = 0; i < liList.length; i++){
			liList[i].onclick = function(){
				alert(i);
			}
		}
	</script>
</body>
</html>